# -*- coding: UTF-8 -*-
#:kivy 1.0
#:import FittableLabel ui.fittable_widgets.FittableLabel
#:import FittableButton ui.fittable_widgets.FittableButton
#:import DisableableButton ui.disableable_button.DisableableButton
#:import ConfirmationButton ui.confirmation_button.ConfirmationButton
#:import LongPressLabel ui.long_press_label.LongPressLabel
#import TextInput ui.fittable_widgets.FittableTextInput

<FromToWidget>:
    delete_button: del_button
    skip_button: sk_button
    next_button: next_btn
    orientation: 'vertical'
    BoxLayout:
        height: root.size[1]*0.2
        size_hint_y: None
        DisableableButton:
            text: _('Current results')
            on_release: root.finish(True)
        FittableLabel:
            text: _('Words left: {}').format(root.words_remaining)
    BoxLayout:
        orientation: 'horizontal'
        size_hint_y: 0.1
        ConfirmationButton:
            id: sk_button
            text_normal: _('Skip turn')
            on_confirm: root.skip()
        ConfirmationButton:
            id: del_button
            text_normal: root.delete_butt_text
            on_confirm: root.delete()
    BoxLayout:
        size_hint_y: 0.1
        FittableLabel:
            text: _('Round: {}').format(root.round_num)
        FittableLabel:
            text: root.time_remaining

    BoxLayout:
        orientation: 'horizontal'
        size_hint_y: 0.25

        LongPressLabel:
            text: root.player_explain
            on_long_press: root.open_popup(root.pair[0])

        FittableLabel:
            length: 2
            text: u'=>'

        LongPressLabel:
            text: root.player_guess
            on_long_press: root.open_popup(root.pair[1])

    ConfirmationButton:
        id: next_btn
        size_hint_y: 0.1
        color_normal: 'green'
        text_normal: root.button_text
        on_confirm: root.finish(False)


<ChangeNamePopup>:
    name_input: name_input
    ok_button: ok_button
    size_hint_y: .5
    pos_hint: {'y': 0.5}
    title: _('Change name')
    BoxLayout:
        orientation: 'vertical'
        TextInput:
            id: name_input
            multiline: False
            size_hint_y: 0.1
            font_size: 0.6 * self.height
            on_text_validate: root.change_name()
            on_text: root.change_text()
        BoxLayout:
            orientation: 'horizontal'
            size_hint_y: 0.2
            Button:
                text: _('Cancel')
                on_release: root.dismiss()
            DisableableButton:
                id: ok_button
                text: _('OK')
                on_release: root.change_name()
